
<h1><span class="yiyi-st" id="yiyi-12">numpy.triu</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.triu.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.triu.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.triu"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.</code><code class="descname">triu</code><span class="sig-paren">(</span><em>m</em>, <em>k=0</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/lib/twodim_base.py#L461-L486"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">数组的上三角形。</span></p>
<p><span class="yiyi-st" id="yiyi-15">返回具有<em class="xref py py-obj">k</em>对角线下方元素的矩阵的副本。</span></p>
<p><span class="yiyi-st" id="yiyi-16">有关详细信息，请参阅<a class="reference internal" href="numpy.tril.html#numpy.tril" title="numpy.tril"><code class="xref py py-obj docutils literal"><span class="pre">tril</span></code></a>的文档。</span></p>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-17">也可以看看</span></p>
<dl class="last docutils">
<dt><span class="yiyi-st" id="yiyi-18"><a class="reference internal" href="numpy.tril.html#numpy.tril" title="numpy.tril"><code class="xref py py-obj docutils literal"><span class="pre">tril</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-19">数组的下三角形</span></dd>
</dl>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-20">例子</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">triu</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">],[</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">],[</span><span class="mi">7</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">],[</span><span class="mi">10</span><span class="p">,</span><span class="mi">11</span><span class="p">,</span><span class="mi">12</span><span class="p">]],</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="go">array([[ 1,  2,  3],</span>
<span class="go">       [ 4,  5,  6],</span>
<span class="go">       [ 0,  8,  9],</span>
<span class="go">       [ 0,  0, 12]])</span>
</pre></div>
</div>
</dd></dl>
